package com.znh.kuiklyuniversity.compose.widgets

import androidx.compose.runtime.Composable
import com.tencent.kuikly.compose.coil3.rememberAsyncImagePainter
import com.tencent.kuikly.compose.foundation.Image
import com.tencent.kuikly.compose.foundation.clickable
import com.tencent.kuikly.compose.foundation.layout.Row
import com.tencent.kuikly.compose.foundation.layout.fillMaxWidth
import com.tencent.kuikly.compose.foundation.layout.height
import com.tencent.kuikly.compose.foundation.layout.padding
import com.tencent.kuikly.compose.foundation.layout.width
import com.tencent.kuikly.compose.foundation.shape.RoundedCornerShape
import com.tencent.kuikly.compose.material3.Text
import com.tencent.kuikly.compose.ui.Alignment
import com.tencent.kuikly.compose.ui.Modifier
import com.tencent.kuikly.compose.ui.draw.clip
import com.tencent.kuikly.compose.ui.graphics.Color
import com.tencent.kuikly.compose.ui.layout.ContentScale
import com.tencent.kuikly.compose.ui.unit.TextUnit
import com.tencent.kuikly.compose.ui.unit.dp
import com.tencent.kuikly.compose.ui.unit.sp
import com.tencent.kuikly.core.base.attr.ImageUri
import com.znh.kuiklyuniversity.compose.selfenum.AppColor
import com.znh.kuiklyuniversity.padding

@Composable
public fun TitleLayout(
    showBack: Boolean = true, backAction: () -> Unit = {}, title: String
) {
    Row(
        modifier = Modifier.fillMaxWidth()
            .padding(top = 36.dp, start = 16.dp),
        verticalAlignment = Alignment.CenterVertically

    ) {
        Image(
            painter = rememberAsyncImagePainter(ImageUri.SCHEME_COMMON_ASSETS + "icon/ic_action_arrow_left.png"),
            contentDescription = "返回",
            contentScale = ContentScale.FillWidth,
            modifier = Modifier
                .width(25.dp)
                .height(25.dp)
                .clickable {
                    backAction()
                }
        )
        Text(
            text = title,
            color = AppColor.TxtCom.color,
            fontSize = 16.sp
        )
    }

}